<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
		<title>来拍车App-竞拍拍单详情页</title>
		<link rel="stylesheet" href="{:get_style_cdnurl()}app/css/home.css">
        <link rel="shortcut icon" href="{:get_style_cdnurl()}app/images/favicon.ico" >
		<script src="{:get_style_cdnurl()}app/js/jquery-1.11.1.js" type="text/javascript"></script>
        <script src="{:get_style_cdnurl()}paimai/cheshan/js/common.js" type="text/javascript"></script>
        <script src="{:get_style_cdnurl()}paimai/cheshan/js/TGJSBridge.js" type="text/javascript"></script>
        <script src="{:get_style_cdnurl()}paimai/cheshan/js/appclient.js" type="text/javascript"></script>
        <script src="{:get_style_cdnurl()}paimai/lib/socket.io-1.3.7.js"></script>
        <script>
            //告知客户端当前拍单关注情况
            appClient.setFollow({$head[is_followed]?1:0});
            document.documentElement.style.webkitUserSelect='none';
            document.documentElement.style.webkitTouchCallout='none';
        </script>
        <style>
            .lock{
                width: 100%;
                position: fixed;
                bottom: 0;
                left: 0;
                height: 60px;
                line-height: 60px;
                color: #fff;
                font-size: 14px;
                font-weight: bold;
                text-align: center;
                display: none;
            }
        </style>
	</head>
	<body>
		<section class="auction">
			<div id="slide"><a href="javascript:appClient.openBasePic('{$head.car_id}');"><img src="{$head.car_pic}" /></a></div>
			<div class="slide-text">
				<h3>{$head.model_show}</h3>
				<span>{$head.first_reg_date}初登/{$head.pointer_mileage}万公里/{$head.emission}/{$head.plate}/{$head.transfer_limit}</span>
			</div>
			<div class="grade" onclick="javascript:appClient.openLevelRules();"><strong>{$head.composite_state}{$head.acc_level}</strong></div>
		</section>
		
		<section class="auction-pai">
			<dl class="clearfix">
                <if condition="$head['status'] eq 301">
                    <dt><strong>待竞拍</strong></dt>
                    <dd>距竞拍开始仅剩<span id="clock3"><b>0</b><font>时</font><b>0</b><font>分</font><b>0</b><font>秒</font></span></dd>
                <else/>
                    <dt><strong>竞拍中</strong></dt>
                    <dd>距竞拍结束仅剩<span id="clock"><b>0</b><font>时</font><b>0</b><font>分</font><b>0</b><font>秒</font></span></dd>
                </if>
			</dl>
			<div class="starting">
                <if condition="$head['status'] eq 301">
                    起拍价: <em><i id="currMoney">{$head.bid_start_price_show}</i><i>元</i></em>
                <else/>
                    当前价：<em class="currMoney" <if condition="$head[coupon] elt 0">style="margin-top: 15px"</if>></em>
                </if>              
               <span>
                    <if condition="$head['show_reserve_price'] eq 1">保留价：{$head['reserve_price']}元　</if>
                    <if condition="$head[coupon] gt 0">
                        可用代金券金额:{$head.coupon}元 
                    </if>
                </span>
               
			</div>
		</section>
		
		<section class="auction-record">
            <a href="javascript:appClient.openBidHistory('{$head.order_id}');">
                <ul class="clearfix">
                    <li>共出价<em id="number">{$head.bid_num}</em>次</li>
                    <li><if condition="$head['bidding_best_price'] gt $head['bid_best_price']">已过投标最高价<else/><samp>未过投标最高价</samp></if></li>
                    <li>全部<img src="{:get_style_cdnurl()}app/images/icon4.png" /></li>
                </ul>
                <span class="record-none" style="display: none">暂时没有出价记录</span>
                <dl id="log_ul" class="clearfix">
                </dl>
            </a>
		</section>
		
		<section class="auction-wenben">
			<ul class="clearfix">
                <li>起拍价：{$head.bid_start_price_show}元</li>
                <li>
                    保留价：
                    <if condition="$head['show_reserve_price'] eq 1">
                        {$head['reserve_price']}元
                        <else/>
                        <if condition="$head['reserve_price'] gt 0">有<else/>无</if>
                    </if>
                </li>
                <li>过户费：{$head.transfer_fee|floatval}元 </li>
                <li>佣金 ：{$head.commision|floatval}元</li>
			</ul>
			<span>竞价成功的车辆，过户费、佣金由买方承担。</span>
		</section>
		
		<section class="auction-btn clearfix auction-btn2"><a href="javascript:appClient.openReport('{$head.car_id}');"><img src="{:get_style_cdnurl()}app/images/icon3.png" />检测报告</a><div class="stroke"></div></section>
		
		<section class="qiChujia auction-offer <if condition="$head['status'] eq 4">auction-offer1</if>">
			<input type="button" value="+300" class="shuzi offer" <if condition="$head['stats'] eq 301">readonly</if>/>
			<input type="button" value="+500" class="shuzi offer"  <if condition="$head['stats'] eq 301">readonly</if>/>
			<input type="button" value="+1000" class="shuzi offer" <if condition="$head['stats'] eq 301">readonly</if>/>
			<input type="button" value="+2000" class="shuzi offer"  <if condition="$head['stats'] eq 301">readonly</if>/>
		    <input type="button" value="出价" class="offer-btn" id="chuJia"/>
		    <div class="alert-text"></div>
            <div class="lock" style=""></div>
		</section>
<if condition="$head['status'] eq 4">
    <script>
        /*
          获取拍品列表
        * @param page 页码
        * @param interval 刷新时间间隔
        * */
        function get_log_list(){
            appClient.bidding_log('{$head.order_id}');
        }
        function bidding_log_rs(res){
            if(typeof(res)=='object'){
                res = eval("(" + res.str + ")");
            }else{
                res = eval("(" + res + ")");
            }
            if(res.data.list == null){
                $('.record-none').show();
                 $('#log_ul').hide();
            }else{
                $('.record-none').hide();
                 $('#log_ul').show();
            }
            var new_li = "";
            $.each(res.data.list, function(index, array) { //遍历返回json
                    if(index==0){
                        new_li += '<dd class="record-first">'+
                                '	<span>领<br>先</span>'+
                                '	<em>'+array['dealer_name']+'<i>'+array['price']+'</i></em>'+
                                '</dd>';
                    }else{
                        new_li += '<dd>'+
                                '	<span>出<br>局</span>'+
                                '	<em>'+array['dealer_name']+'<i>'+array['price']+'</i></em>'+
                                '</dd>';
                    }
            });
            $('#log_ul').replaceWith('<dl id="log_ul" class="clearfix">'+new_li+'</dl>');
        }
        get_log_list();
    </script>
</if>
<script>
$(document).ready(function() {
    var order_id = '{$head.order_id}';
    var dealer_id = '{$head.dealer_id}';

    $(".auction-offer1 .offer").click(function(){
        $(".auction-offer1 .offer").removeClass("offer1");
        $(this).addClass("offer1");
    })

});
$(".auction-offer1 .offer").click(function(){
	$(".auction-offer1 .offer").css({"width":"18.5%","color":"#3399ff","background":"#fff","border":"none","marginRight":"0.8%"});
	$(this).css({"width":"18.5%","color":"#fff","background":"#3399ff","border":"none","marginRight":"0.8%"});
})
</script>
<if condition="$head['status'] eq 301">
<script type="text/javascript" >
    $('.record-none').show();
    function run_zhong(left_time){
                left_time=typeof(left_time)=='undefined'?0:parseInt(left_time);
                var cd = new CountDown(left_time);
                cd.set_show_tpl(function(data){ //设置展示模板
                    $('#clock3').html('<b>'+data.o+'</b><font>时</font><b>'+data.m+'</b><font>分</font><b>'+data.s+'</b><font>秒</font>');
                });
                cd.over(function(o){appClient.reload()});
    }
    run_zhong('{$head.left_time}');
    </script>
<else/>
    <script type="text/javascript" src="{:get_style_cdnurl()}paimai/cheshan/js/bidding_app.js"></script>
    <script type="text/javascript" >
    var bidding = new Bidding('{$head.order_no}','{$Think.config.WEBSOCKET_SRV_URL}','{$head.dealer_id}','{$head.order_id}');
    var init_data = eval('[{$bidding_info}]');
    bidding.show_ret(init_data[0]);
    var tt_obj = null;
    bidding.complete(function(data){ //提标完成回调
        clearTimeout(tt_obj);
        tt_obj = setTimeout(function(){get_log_list()},Math.floor(Math.random() * 2000 + 100));
    });
    function bidding_rs(res){
         bidding.bidding_rs(res);
    }
    </script>
</if>
    <script>
        $(document).ready(function() {
               //绑定follow_rs,bid_rs app回调函数
                appClient.bind();
        })
    </script>
	</body>
</html>